<!doctype html>
<html lang="zh" class="no-js">
<html  xmlns:th="http://www.thymeleaf.org"
  xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3">
<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> 
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>bootstrap 成绩管理</title>
	<link rel="stylesheet" href="static/main/css/reset.css"> <!-- CSS reset -->
	<link rel="stylesheet" type="text/css" href="static/main/css/default.css">
	<link rel="stylesheet" href="static/main/css/style.css"> <!-- Resource style -->
	
	<link rel="stylesheet" type="text/css" href="webjars/bootstrap/3.3.7/css/bootstrap.css" />
	<link rel="stylesheet" type="text/css" href="webjars/bootstrap/3.3.7/css/bootstrap-theme.css" />
	<link rel="stylesheet" type="text/css" href="webjars/bootstrapvalidator/0.5.3/css/bootstrapValidator.css" />
	<link rel="stylesheet" type="text/css" href="webjars/bootstrap-table/1.16.0/bootstrap-table.css" />
	<link rel="stylesheet" type="text/css" href="webjars/jquery.treegrid/0.2.1/css/jquery.treegrid.css" />
	<link rel="stylesheet" type="text/css" href="static/bootstrap-treeview/css/bootstrap-treeview.css" />
	
		
	<script src="webjars/jquery/1.11.1/jquery.js" type="text/javascript" charset="utf-8"></script>
	<script src="webjars/bootstrap/3.3.7/js/bootstrap.js" type="text/javascript" charset="utf-8"></script>
	<script src="webjars/bootstrap-table/1.16.0/bootstrap-table.js" type="text/javascript" charset="utf-8"></script>
	<script src="webjars/bootstrap-table/1.16.0/locale/bootstrap-table-zh-CN.js" type="text/javascript" charset="utf-8"></script>
	<script src="webjars/bootstrap-table/1.16.0/extensions/treegrid/bootstrap-table-treegrid.js" type="text/javascript" charset="utf-8"></script>
	<script src="webjars/jquery.treegrid/0.2.1/js/jquery.treegrid.js" type="text/javascript"></script>
	<script src="webjars/bootbox/5.4.0/bootbox.all.js" type="text/javascript" charset="utf-8"></script>
	<script src="webjars/bootstrapvalidator/0.5.3/js/bootstrapValidator.js" type="text/javascript" charset="utf-8"></script>
	<script src="webjars/bootstrapvalidator/0.5.3/js/language/zh_CN.js" type="text/javascript" charset="utf-8"></script>
	<script src="static/bootstrap-treeview/js/bootstrap-treeview.js" type="text/javascript" charset="utf-8"></script>	
	<script src="static/js/bootstrap-tooltip.js" type="text/javascript" charset="utf-8"></script>
	<script src="static/custom/custom.js" type="text/javascript" charset="utf-8"></script>
	
	<script src="static/main/js/modernizr.js"></script> <!-- Modernizr -->
</head>
<body>
	<header class="cd-main-header">
		<a href="#0" class="cd-logo"><img src="static/image/2.png" alt="Logo" width="300px" style="position: relative;top:-20px;" ></a>
		<nav class="cd-nav">
			<ul class="cd-top-nav">
				<li class="has-children account" style="width: 200px;">
					<a href="#0">
						<span sec:authentication="principal.name"/>
					</a>
					<ul>
						<li><a href="#" onclick="pwd()">修改密码</a></li>
						<li><a href="logout">退出</a></li>
					</ul>
				</li>
			</ul>
		</nav>
	</header>

	<main class="cd-main-content">
		<nav class="cd-side-nav">
			<ul>
				<li class="cd-label">bootstrap 成绩管理</li>
				<li class="has-children overview" sec:authorize="hasRole('ROLE_ADMIN')||hasRole('ROLE_TEACHER')">
					<a href="#0">成绩管理</a>
					
					<ul>
						 <li><a href="#" onclick="classcourse()">班级成绩录入</a></li>
			             <li><a href="#" onclick="selfgrade()">个人成绩录入</a></li>
			             <li><a href="#" onclick="classgrade()">班级成绩查询</a></li>
					</ul>
				</li>
				<li class="has-children comments" sec:authorize="hasRole('ROLE_ADMIN')||hasRole('ROLE_TEACHER')">
					<a href="#0">信息管理</a>
					<ul>
						 <li><a href="#" onclick="kcgl()">课程管理</a></li>
					     <li><a href="#" onclick="jsgl()">教师管理</a></li>
					     <li><a href="#" onclick='xsgl()'>学生管理</a></li>
					     <li><a href="#" onclick="bmgl()">部门管理</a></li>
					</ul>
				</li>
				<li class="has-children comments" sec:authorize="hasRole('ROLE_STUDENT')">
					<a href="#0" onclick="self()">个人成绩查询</a>
				</li>
				<li class="has-children comments" sec:authorize="hasRole('ROLE_STUDENT')">
					<a href="#0" onclick="classcj()">班级成绩查询</a>
				</li>
			</ul>
		</nav>

		<div  style="height:100%" class="content-wrapper ">
			<div class="container" id="zhuye"  style="display: flex; flex-direction: column;margin-top: 3px;margin-left: 20px; ">
				<div id="admin" sec:authorize="hasRole('ROLE_ADMIN')||hasRole('ROLE_TEACHER')">
				 <h3>欢迎登陆bootstrap成绩管理系统</h3>
					<h4>管理员账号：admin</h4>
					<h4>管理员初始密码：1234</h4>
					<h4>学生账号：学号</h4>
					<h4>学生初始密码：1111</h4>
				 </div>
				 <div id="stu" sec:authorize="hasRole('ROLE_STUDENT')" >
				  <h3>欢迎登陆bootstrap成绩管理系统</h3>
					<h4>学生账号：学号</h4>
					<h4>学生初始密码：1111</h4>
				 </div>
			</div>
		</div>
	</main> 

	<script src="static/main/js/jquery.menu-aim.js"></script>
	<script src="static/main/js/main.js"></script> <!-- Resource jQuery -->
</body>
<script type="text/javascript">
		$(function(){
			
		});
		//班级成绩录入
		function classcourse(){
			$('#zhuye').empty();
			$('#zhuye').load('grade/classcourse');
		}
		//个人成绩录入
		function selfgrade(){
			$('#zhuye').empty();
			$('#zhuye').load('grade/selfgrade');
		}
		//班级成绩查询	
		function classgrade(){
			$('#zhuye').empty();
			$('#zhuye').load('grade/classgrade');
		}
		//课程管理
		function kcgl() {
			$('#zhuye').empty();
			$('#zhuye').load('course/manage');
		}
		//部门管理
		function bmgl(){
			$('#zhuye').empty();
			$('#zhuye').load('menu/manage');
		}
		//教师管理
		function jsgl(){
			$('#zhuye').empty();
			$('#zhuye').load('teacher/manage');
		}
		//学生管理
		function xsgl(){
			$('#zhuye').empty();
			$('#zhuye').load('student/manage');
		}
		//学生个人成绩查询
		function self(){
			$('#zhuye').empty();
			$('#zhuye').load('grade/self');
		}
		//学生班级成绩查询
		function classcj(){
			$('#zhuye').empty();
			$('#zhuye').load('grade/classcj');
		}
		//修改密码
		function pwd(){
			var dialog=$.createDialog({
				title:'修改密码',
				url:'teacher/pwd',
				buttons:[$.createBtn({
					iconCls:'glyphicon glyphicon-ok',
					btnCls:'btn btn-primary',
					text:'修改',
					handler:function(){
						var btn=$(this);
						var form=btn.closest('div.modal-content').find('div.modal-body').find('form.bv-form');
						var formdata=form.serializeObject();
						var password1=formdata.password1;
						var password2=formdata.password2;
						var password3=formdata.password3;
						var params=form.serialize();
						console.log(password3);
						
						var validator=form.data('bootstrapValidator');
						validator.validate();
						if(validator.isValid()){
							$.post('password/save',params,function(data){
								bootbox.alert(data.msg);
								if(data.msg=="修改成功"){
									bootbox.alert("密码修改成功，请重新登录")
									window.location="login?logout";
								}
							})
						}
					}
				}),$.createBtn({
					iconCls:'glyphicon glyphicon-remove',
					text:'关闭',
					isCloseBtn:true
				})]
			});
			dialog.modal('show');
		}
	</script>
</html>